﻿using System;
using System.Collections.Generic;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Content;

namespace Comp_GeoData
{
    public class LineSegment
    {
        #region Members

        private Vector2 startPoint, endPoint;
        private Vector2 offsetStartPoint;

        #endregion

        #region Properties

        public Vector2 StartPoint
        {
            get { return startPoint; }
            set { startPoint = value; }
        }

        public Vector2 EndPoint
        {
            get { return endPoint; }
            set { endPoint = value; }
        }

        [ContentSerializerIgnore]
        public Vector2 MidPoint
        {
            get { return new Vector2(((startPoint.X + endPoint.X) / 2), ((startPoint.Y + endPoint.Y) / 2)); }
        }

        [ContentSerializerIgnore]
        public float Length
        {
            get { return (float)Math.Sqrt(Math.Pow(startPoint.X - endPoint.X, 2) + Math.Pow(startPoint.Y - endPoint.Y, 2)); }
        }

        #endregion

        #region Initilization

        public LineSegment() { }
        public LineSegment(Vector2 startPoint, Vector2 endPoint)
        {
            this.startPoint = startPoint;
            this.endPoint = endPoint;
        }

        #endregion
    }
}
